package lessons.no4.no47;

/*
 * 第4.7.3 try..catch finally
 */
public class No4_7_3 {
    public static void main(String[] args) {
        System.out.println("1/2 = "+divide(1, 2));
        System.out.println("1/0 = "+divide(1, 0));
    }

    static public double divide(int x,int y)
    {

        try {
            return x/y;
        } catch (Exception e) {
            // TODO: handle exception
            System.out.println("除法异常 异常信息:"+e.getMessage());
        }
        finally
        {
            System.out.println("执行 finally 代码");
        }
        return -1;
    }
}
